package widget.dialog;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import net.ck.hzq.R;

import java.util.ArrayList;

public class TiShiDialog extends MyDialog implements View.OnClickListener {
    private static final String TAG = "TiShiDialog";
    private ArrayList<EditText> array = new ArrayList<EditText>();

    private String money="";
    private Context mContext;

    private DialogCallback callback;

    private OnEditTextListener onEditTextListener;

    private Button submit;
    private TextView content;


    public OnEditTextListener getOnEditTextListener() {
        return onEditTextListener;
    }

    public void setOnEditTextListener(OnEditTextListener onEditTextListener) {
        this.onEditTextListener = onEditTextListener;
    }


    public interface OnEditTextListener {
        void inputComplete(int state, String password);
    }

    public TiShiDialog(@NonNull Context context, DialogCallback callback) {
        this(context, R.style.MyDialog, callback);
    }

    public TiShiDialog(@NonNull Context context, int themeResId, DialogCallback callback) {
        super(context, themeResId);
        mContext = context;
        this.callback = callback;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "onCreate: ");
        initView();
    }


    private void initView() {
        setContentView(R.layout.dialog_tishi);
        WindowManager windowManager = getWindow().getWindowManager();
        int screenWidth = windowManager.getDefaultDisplay().getWidth();
        int screenHeight = windowManager.getDefaultDisplay().getHeight();
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
//        attributes.alpha = 0.3f;
        attributes.width = screenWidth;
        attributes.height = screenHeight;
//        attributes.gravity = Gravity.CENTER;
        getWindow().setAttributes(attributes);
        setCancelable(true);
        content = findViewById(R.id.content);
        submit = findViewById(R.id.btn_submit);
        submit.setOnClickListener(this);
        content.setText(money);
        findViewById(R.id.layout_pwd_close).setOnClickListener(this);
    }




    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_submit:
                if (callback != null)
                    callback.OnConfirm();
                break;
            case R.id.layout_pwd_close:
                this.dismiss();
                break;
            default:
                break;
        }
    }
public void initmoney(String inmoney){
        money = "预约提现金额"+inmoney+"元于30天内到账";
        if(null!=content) {
            content.setText(money);
        }
}

}
	
